#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e3+10;

typedef struct {int u,v;}edge;

#define pb push_back

vector<int> g[MAXN];

int n,m,col[MAXN],tot;
edge e[MAXN*200];
bool G1[MAXN][MAXN],G2[MAXN][MAXN];
int vis[MAXN];

void dfs(int x,int st){
	vis[x] = tot; G1[st][x] = 1;
	for(int i = 0;i < g[x].size();i++){
		int y = g[x][i];
		if(vis[y] != tot) dfs(y,st);
	}
}

void dfs1(int x,int co,int st,int tp){
	vis[x] = tot;
	if(tp) G2[st][x] = (co != col[x]);
	else col[x] = co;
	for(int i = 0;i < g[x].size();i++){
		int y = g[x][i];
		if(vis[y] != tot) dfs1(y,co,st,tp);
	}
}

int main (){
	scanf("%d %d",&n,&m);
	for(int i = 1;i <= m;i++){
		int x,y;scanf("%d %d",&x,&y);
		g[x].pb(y);
		e[i].u = x;e[i].v = y;
	}
	for(int i = 1;i <= n;i++) tot++,dfs(i,i);
	for(int i = 1;i <= n;i++){
		memset(col,0,sizeof(col));
		tot++; vis[i] = tot;
		for(int j = 0;j < g[i].size();j++){
			int y = g[i][j];
			if(vis[y] != tot) dfs1(y,j+1,i,0);
		}
		tot++; vis[i] = tot;
		for(int j = (int)g[i].size()-1;~j;j--){
			int y = g[i][j];
			if(vis[y] != tot) dfs1(y,j+1,i,1);
		}
	}
	for(int i = 1;i <= m;i++){
		if(G2[e[i].u][e[i].v] ^ G1[e[i].v][e[i].u]) puts("diff");
		else puts("same");
	}
	return 0;
}
